<?php

namespace Modules\Advert\Entities;

use Modules\Goods\Entities\Goods;
use Illuminate\Database\Eloquent\Model;

class Topic extends Model
{
    protected $fillable = [];
    protected $hidden = ['order', 'created_at', 'updated_at'];

    protected $casts = [
        'merchant_id' => 'integer',
        'style' => 'integer',
        'type' => 'integer',
        'order' => 'integer',
    ];

    public function goods()
    {
        return $this->hasManyThrough(Goods::class, TopicItem::class, 'topic_id', 'id', 'id', 'item_id')->with('sku');
    }
}
